<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html 
     PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
  <title>Module: ActionController::Caching</title>
  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
  <meta http-equiv="Content-Script-Type" content="text/javascript" />
  <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
  <script type="text/javascript">
  // <![CDATA[

  function popupCode( url ) {
    window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
  }

  function toggleCode( id ) {
    if ( document.getElementById )
      elem = document.getElementById( id );
    else if ( document.all )
      elem = eval( "document.all." + id );
    else
      return false;

    elemStyle = elem.style;
    
    if ( elemStyle.display != "block" ) {
      elemStyle.display = "block"
    } else {
      elemStyle.display = "none"
    }

    return true;
  }
  
  // Make codeblocks hidden by default
  document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
  
  // ]]>
  </script>

</head>
<body>



    <div id="classHeader">
        <table class="header-table">
        <tr class="top-aligned-row">
          <td><strong>Module</strong></td>
          <td class="class-name-in-header">ActionController::Caching</td>
        </tr>
        <tr class="top-aligned-row">
            <td><strong>In:</strong></td>
            <td>
                <a href="../../files/vendor/rails/actionpack/lib/action_controller/caching_rb.html">
                vendor/rails/actionpack/lib/action_controller/caching.rb
                </a>
        <br />
                <a href="../../files/vendor/rails/actionpack/lib/action_controller/caching/actions_rb.html">
                vendor/rails/actionpack/lib/action_controller/caching/actions.rb
                </a>
        <br />
                <a href="../../files/vendor/rails/actionpack/lib/action_controller/caching/fragments_rb.html">
                vendor/rails/actionpack/lib/action_controller/caching/fragments.rb
                </a>
        <br />
                <a href="../../files/vendor/rails/actionpack/lib/action_controller/caching/pages_rb.html">
                vendor/rails/actionpack/lib/action_controller/caching/pages.rb
                </a>
        <br />
                <a href="../../files/vendor/rails/actionpack/lib/action_controller/caching/sql_cache_rb.html">
                vendor/rails/actionpack/lib/action_controller/caching/sql_cache.rb
                </a>
        <br />
                <a href="../../files/vendor/rails/actionpack/lib/action_controller/caching/sweeping_rb.html">
                vendor/rails/actionpack/lib/action_controller/caching/sweeping.rb
                </a>
        <br />
            </td>
        </tr>

        </table>
    </div>
  <!-- banner header -->

  <div id="bodyContent">



  <div id="contextContent">

    <div id="description">
      <p>
<a href="Caching.html">Caching</a> is a cheap way of speeding up slow
applications by keeping the result of calculations, renderings, and
database calls around for subsequent requests. Action Controller affords
you three approaches in varying levels of granularity: Page, Action,
Fragment.
</p>
<p>
You can read more about each approach and the sweeping assistance by
clicking the modules below.
</p>
<p>
Note: To turn off all caching and sweeping, set Base.perform_caching =
false.
</p>
<h2><a href="Caching.html">Caching</a> stores</h2>
<p>
All the caching stores from <a
href="../ActiveSupport/Cache.html">ActiveSupport::Cache</a> is available to
be used as backends for Action Controller caching. This setting only
affects action and fragment caching as page caching is always written to
disk.
</p>
<p>
Configuration examples (MemoryStore is the default):
</p>
<pre>
  ActionController::Base.cache_store = :memory_store
  ActionController::Base.cache_store = :file_store, &quot;/path/to/cache/directory&quot;
  ActionController::Base.cache_store = :drb_store, &quot;druby://localhost:9192&quot;
  ActionController::Base.cache_store = :mem_cache_store, &quot;localhost&quot;
  ActionController::Base.cache_store = MyOwnStore.new(&quot;parameter&quot;)
</pre>

    </div>


   </div>

    <div id="method-list">
      <h3 class="section-bar">Methods</h3>

      <div class="name-list">
      <a href="#M000871">cache</a>&nbsp;&nbsp;
      <a href="#M000870">cache_configured?</a>&nbsp;&nbsp;
      <a href="#M000869">cache_store=</a>&nbsp;&nbsp;
      </div>
    </div>

  </div>


    <!-- if includes -->
    <div id="includes">
      <h3 class="section-bar">Included Modules</h3>

      <div id="includes-list">
        <span class="include-name"><a href="Caching/Pages.html">Pages</a></span>
        <span class="include-name"><a href="Caching/Actions.html">Actions</a></span>
        <span class="include-name"><a href="Caching/Fragments.html">Fragments</a></span>
        <span class="include-name"><a href="Caching/Sweeping.html">Sweeping</a></span>
        <span class="include-name"><a href="Caching/SqlCache.html">SqlCache</a></span>
      </div>
    </div>

    <div id="section">

    <div id="class-list">
      <h3 class="section-bar">Classes and Modules</h3>

      Module <a href="Caching/Actions.html" class="link">ActionController::Caching::Actions</a><br />
Module <a href="Caching/Fragments.html" class="link">ActionController::Caching::Fragments</a><br />
Module <a href="Caching/Pages.html" class="link">ActionController::Caching::Pages</a><br />
Module <a href="Caching/SqlCache.html" class="link">ActionController::Caching::SqlCache</a><br />
Module <a href="Caching/Sweeping.html" class="link">ActionController::Caching::Sweeping</a><br />

    </div>




      


    <!-- if method_list -->
    <div id="methods">
      <h3 class="section-bar">Public Class methods</h3>

      <div id="method-M000870" class="method-detail">
        <a name="M000870"></a>

        <div class="method-heading">
          <a href="#M000870" class="method-signature">
          <span class="method-name">cache_configured?</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000870-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000870-source">
<pre>
    <span class="ruby-comment cmt"># File vendor/rails/actionpack/lib/action_controller/caching.rb, line 50</span>
50:         <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">cache_configured?</span>
51:           <span class="ruby-identifier">perform_caching</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">cache_store</span>
52:         <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000869" class="method-detail">
        <a name="M000869"></a>

        <div class="method-heading">
          <a href="#M000869" class="method-signature">
          <span class="method-name">cache_store=</span><span class="method-args">(store_option)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Defines the storage option for cached fragments
</p>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000869-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000869-source">
<pre>
    <span class="ruby-comment cmt"># File vendor/rails/actionpack/lib/action_controller/caching.rb, line 40</span>
40:         <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">cache_store=</span>(<span class="ruby-identifier">store_option</span>)
41:           <span class="ruby-ivar">@@cache_store</span> = <span class="ruby-constant">ActiveSupport</span><span class="ruby-operator">::</span><span class="ruby-constant">Cache</span>.<span class="ruby-identifier">lookup_store</span>(<span class="ruby-identifier">store_option</span>)
42:         <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <h3 class="section-bar">Protected Instance methods</h3>

      <div id="method-M000871" class="method-detail">
        <a name="M000871"></a>

        <div class="method-heading">
          <a href="#M000871" class="method-signature">
          <span class="method-name">cache</span><span class="method-args">(key, options = {}) {|| ...}</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Convenience accessor
</p>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000871-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000871-source">
<pre>
    <span class="ruby-comment cmt"># File vendor/rails/actionpack/lib/action_controller/caching.rb, line 58</span>
58:       <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">cache</span>(<span class="ruby-identifier">key</span>, <span class="ruby-identifier">options</span> = {}, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>)
59:         <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">cache_configured?</span>
60:           <span class="ruby-identifier">cache_store</span>.<span class="ruby-identifier">fetch</span>(<span class="ruby-constant">ActiveSupport</span><span class="ruby-operator">::</span><span class="ruby-constant">Cache</span>.<span class="ruby-identifier">expand_cache_key</span>(<span class="ruby-identifier">key</span>, <span class="ruby-identifier">:controller</span>), <span class="ruby-identifier">options</span>, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>)
61:         <span class="ruby-keyword kw">else</span>
62:           <span class="ruby-keyword kw">yield</span>
63:         <span class="ruby-keyword kw">end</span>
64:       <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>


    </div>


  </div>


<div id="validator-badges">
  <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>

</body>
</html>